sgwt_check_connected : Check connectedness of graph function r=sgwt_check_connected(A) returns 1 if graph is connected, 0 otherwise Uses boost graph library breadth first search Inputs : A - adjacency matrix Outputs : r - result
0001 % sgwt_check_connected : Check connectedness of graph 0002 % 0003 % function r=sgwt_check_connected(A) 0004 % 0005 % returns 1 if graph is connected, 0 otherwise 0006 % Uses boost graph library breadth first search 0007 % 0008 % Inputs : 0009 % A - adjacency matrix 0010 % 0011 % Outputs : 0012 % r - result 0013 % 0014 0015 % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 0016 % Copyright (C) 2010, David K. Hammond. 0017 % 0018 % The SGWT toolbox is free software: you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation, either version 3 of the License, or 0021 % (at your option) any later version. 0022 % 0023 % The SGWT toolbox is distributed in the hope that it will be useful, 0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0026 % GNU General Public License for more details. 0027 % 0028 % You should have received a copy of the GNU General Public License 0029 % along with the SGWT toolbox. If not, see <http://www.gnu.org/licenses/>. 0030 0031 function r=sgwt_check_connected(A) 0032 d=bfs(A,1); 0033 r=~any(d==-1); 0034